package gameobjects;

import java.util.ArrayList;

public class Bullet extends Entity {
	
	private int speed;
	private int damage;
	private int penetrate;
	private long launchTime;
	private int lifeTime;
	private int team;
	private int homingType;
	private ArrayList<Integer> hits;
	
	public Bullet(int h, String n, String s, int x, int y, int w, int he,
			int speed, int damage, int penetrate, int launchTime, int lifeTime,
			int team, int homingType) {
		super(h, n, s, x, y, w, he);
		this.speed = speed;
		this.damage = damage;
		this.penetrate = penetrate;
		this.launchTime = launchTime;
		this.lifeTime = lifeTime;
		this.team = team;
		this.homingType = homingType;
		hits = new ArrayList<Integer>();
	}
	
	public Bullet(Bullet b, int handle,  int x, int y, long launchTime){
		super(handle,b.getName(),b.getSpriteName(),x,y,b.getW(),b.getH());
		speed = b.getSpeed();
		damage = b.getDamage();
		penetrate = b.getPenetrate();
		this.launchTime = launchTime;
		lifeTime = b.getLifeTime();
		team = b.getTeam();
		homingType = b.getHomingType();
		hits = new ArrayList<Integer>();
	}

	public int getSpeed() {
		return speed;
	}

	public void setSpeed(int speed) {
		this.speed = speed;
	}

	public int getDamage() {
		return damage;
	}

	public void setDamage(int damage) {
		this.damage = damage;
	}

	public int getPenetrate() {
		return penetrate;
	}

	public void setPenetrate(int penetrate) {
		this.penetrate = penetrate;
	}

	public long getLaunchTime() {
		return launchTime;
	}

	public void setLaunchTime(int launchTime) {
		this.launchTime = launchTime;
	}

	public int getLifeTime() {
		return lifeTime;
	}

	public void setLifeTime(int lifeTime) {
		this.lifeTime = lifeTime;
	}

	public int getTeam() {
		return team;
	}

	public void setTeam(int team) {
		this.team = team;
	}

	public int getHomingType() {
		return homingType;
	}

	public void setHomingType(int homingType) {
		this.homingType = homingType;
	}
	
	public boolean isAlreadyHit(Entity ent){
		return hits.contains(ent.getHandle());
	}
	
	public void hit(Entity ent){
		hits.add(ent.getHandle());
	}
}
